package com.cosmoplat.xikai.common.enums.business;

import lombok.Getter;

/**
 * @ClassName AlarmTypeEnum
 * @Description 告警类型
 * @Author wdf
 * @Date 2025/1/13
 */
@Getter
public enum AlarmTypeEnum {

    /**
     * 告警类型  1：质量异常告警，2：缺料告警，3：物料错误告警
     **/
    QUALITY_EXCEPTION(1, "质量异常告警"),
    MISSING_MATERIAL(2, "缺料告警"),
    MATERIAL_ERROR(3, "物料错误告警");

    private Integer code;
    private String name;

    AlarmTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByCode(Integer alarmType) {
        if (alarmType == null) {
            return null;
        }
        for (AlarmTypeEnum alarmTypeEnum : AlarmTypeEnum.values()) {
            if (alarmTypeEnum.getCode().equals(alarmType)) {
                return alarmTypeEnum.getName();
            }
        }
        return null;
    }
}
